package com.fulihui.weixinclient.request;

import com.alibaba.fastjson.JSON;
import com.fulihui.weixinclient.result.UserInfoWeixinResult;

/**
 *
 * Created by Willard on 2015/10/8.
 */
public class UserInfoWeixinRequest extends FuncWeixinRequest<UserInfoWeixinResult> {
    private static final long serialVersionUID = -4036181730419192772L;

    /* 用户的唯一标识 */
    private String            openid;

    /* 返回国家地区语言版本 */
    private String            lang             = "zh_CN";

    @Override
    protected void childParam() {
        super.childParam();
        addParam("openid", openid);
        addParam("lang", lang);
    }

    @Override
    public String service() {
        return "https://api.weixin.qq.com/cgi-bin/user/info";
    }

    @Override
    public String urlEndStr() {
        return null;
    }

    @Override
    public UserInfoWeixinResult parseResult(String respStr) {
        UserInfoWeixinResult result = JSON.parseObject(respStr, UserInfoWeixinResult.class);
        checkResult(result);
        return result;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getLang() {
        return lang;
    }

    public void setLang(String lang) {
        this.lang = lang;
    }
}
